Skip to content

Syncing from upstream OCA/queue (19.0) - #576

Merged
bt-admin merged 5 commits into
brain-tec:19.0from
OCA:19.0
Jul 21, 2026
Merged

Syncing from upstream OCA/queue (19.0)#576
bt-admin merged 5 commits into
brain-tec:19.0from
OCA:19.0

Conversation

@bt-admin

Copy link
Copy Markdown

bt_gitbot

dannyadair and others added 5 commits June 29, 2026 04:25
runjob is declared auth="none", so _auth_method_none pins request.env
and transaction.default_env to a uid=None env. `env = http.request.env(
user=SUPERUSER_ID)` only creates a local superuser env, leaving the
default_env as uid=None. Any flush that goes through
Transaction.flush() -> default_env.flush_all() then recomputes stored
fields as uid=None and fails on anything dereferencing self.env.user.

`http.request.update_env(user=SUPERUSER_ID)` additionally sets
transaction.default_env to the superuser env.

Closes #922
Adds test_run_job_controller_http.py covering #922:
- test_runjob_pins_default_env_to_superuser asserts that when
  _acquire_job is entered, env.transaction.default_env.uid is
  SUPERUSER_ID -- the state a job would inherit at perform time.
- test_runjob_without_updating_default_env_leaves_uid_none patches
  Request.update_env to a no-op and verifies default_env.uid stays
  None, isolating default_env repointing as the load-bearing
  behavior of runjob.

Tests use HttpCase so _auth_method_none, session handling, and
update_env run for real. _acquire_job is patched to return None so
the endpoint exits cleanly without performing DB work (its internal
commit is forbidden inside tests).
Co-authored-by: Guewen Baconnier <guewen@baconnier.me>
Signed-off-by sbidoul
@bt-admin bt-admin added the 19.0 label Jul 21, 2026
@bt-admin
bt-admin merged commit 5d064ae into brain-tec:19.0 Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants